<!--
 * @Author: liaoyu1992 1519778181@qq.com
 * @Date: 2022-11-05 08:41:50
 * @LastEditors: liaoyu1992 1519778181@qq.com
 * @LastEditTime: 2022-11-11 22:03:03
 * @FilePath: \kgantt\core\components\other\VerticalScroll.vue
 * @Description: 
-->
<template>
  <div
    :style="
      'height:' +
      ganttHeight +
      'px;marginTop:' +
      headerHeight +
      'px;marginLeft:' +
      rtl
        ? ''
        : '-1rem'
    "
    class="kgantt-scrollV"
    @scroll="onScroll"
    ref="scrollRef"
  >
    <div :style="'height:' + ganttFullHeight + 'px;width: 10px'" />
  </div>
</template>
<script lang="ts" setup>
import { onMounted, ref, nextTick } from "vue";
 defineProps({
  scroll: {
    type: Number,
    default: 0,
  },
  ganttHeight: {
    type: Number,
    default: 0,
  },
  ganttFullHeight: {
    type: Number,
    default: 0,
  },
  headerHeight: {
    type: Number,
    default: 0,
  },
  rtl: {
    type: Boolean,
    default: false,
  },
});
const emits = defineEmits(["onScroll"]);
const scrollRef = ref();
const onScroll = (event: Event) => {
  emits("onScroll", event);
};
onMounted(() => {
  nextTick(() => {
    if (scrollRef.value) {
      scrollRef.value.scrollTop = scroll;
    }
  });
});
</script>